package com.develrage.GeneralTools;

import java.io.PrintStream;
import java.util.Date;

public class Log
{
    public static boolean LogDebug = false;
    public static boolean LogTime = true;
    public static PrintStream defaultOutput = System.out;

    public static boolean isLogTime()
    {
	return LogTime;
    }

    public static void setLogTime(boolean logTime)
    {
	LogTime = logTime;
    }

    public static boolean isLogDebug()
    {
	return LogDebug;
    }

    public static void setLogDebug(boolean logDebug)
    {
	Log.normal("Log level set to DEBUG");
	LogDebug = logDebug;
    }

    public static void echo(String msg)
    {
	defaultOutput.println(msg);
    }

    public static void insertTime()
    {
	if (LogTime)
	{
	    Date d = new Date();
	    defaultOutput.print(d.toString() + " ");
	}

    }

    public static void debug(String msg)
    {
	insertTime();
	if (LogDebug)
	    defaultOutput.println("[DEBUG] " + msg);
    }

    public static void normal(String msg)
    {
	insertTime();
	defaultOutput.println("[NORMAL] " + msg);
    }
}
